package repository.impl;

import java.text.NumberFormat;
import java.util.Locale;

//TODO: va aca o en el repo de purchase?
public class IncomeReport {
	String period;
	String income;
	private static NumberFormat nf = NumberFormat.getInstance(Locale.getDefault());;
	
	public IncomeReport(String period, double income) {
		String incomeF;
		
		this.period = period;
		if (income < 0) {
			income = 0; // assign 0 by default if negative
		}
		nf.setMinimumFractionDigits(2);
		nf.setMaximumFractionDigits(2);
		incomeF = nf.format(income);
		this.income = incomeF;
	}

	public String getPeriod() {
		return period;
	}

	public void setPeriod(String period) {
		this.period = period;
	}

	public String getIncome() {
		return income;
	}

	public void setIncome(double income) {
		String incomeF = nf.format(income);
		this.income = incomeF;
	}
}
